﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{pageTitle}</title>
<link rel="stylesheet" type="text/css" href="template/default.css">
<link rel="stylesheet" type="text/css" href="default.css">
<script src="js/jquery/jquery.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<script type="text/javascript">
function check(form)
{
	if(form.userid.value=="")
	{
		alert("Set an Id!");
		return false;
	}else if(form.username.value=="")
	{
		alert("Set a name!");
		return false;
	}else if(form.password.value!=form.password1.value)
	{
		alert("The passwords are not same!");
		return false;
	}
	return true;
}
function pDisplaySwitch(a)
{	
	a_s = document.getElementById(a).style.display;
	if(a_s == "" || a_s == "block"){
		document.getElementById(a).style.display = "none";
	} else if(a_s == "none"){
		document.getElementById(a).style.display = "";
		document.getElementById(a).style.display = "block";
	}
}
function show(a)
{	
	document.getElementById(a).style.display = "";
	document.getElementById(a).style.display = "block";
}
function hide(a)
{	
	document.getElementById(a).style.display = "none";
}
function submitRating(evt)
{
	var tmp = evt.target.getAttribute('id').substr(5);
	var ip = "{ip}";
	var uid = "{user_id}";
	var widgetId = tmp.substr(0, tmp.indexOf('_'));
	var ownerType = widgetId.substr(0,1);
	var ratingType = widgetId.substr(1,1);
	var ownerId =  widgetId.substr(2,widgetId.length - 2);
	var starNbr = Number(tmp.substr(tmp.indexOf('_')+1)) + 1;
	$.get("./rating_submit.php",
    	{
			ratingType: ratingType, 
			ownerType: ownerType,
			ownerId: ownerId, 
			ip: ip, 
			userId: uid,
			value: starNbr
		},
    	function(data){
			alert(data);
			if(data == "Thank you for rating!"){
				window.location.reload(true);
			}
		}
    );
}
function jqueryInit()
{
	init_rating();
	$('div.rating/img').bind('click', submitRating);
}
function goToLink(target)
{
	self.location = target;
}
$(document).ready(jqueryInit);
</script>
</head>
<body>
{user_session}
<div id="container" style="display:{contentView}">
{note}
<h1>{title}</h1>
<form action="user.php{params}" onSubmit="return check(this);" method="POST">
	<div class="user_view">Id: 
    	<input id="userid" name="userid" maxLength="10" value="{userId}" style="display:{idView}">
		<span class="user_view_keys" style="display:{idViewSpan}">{userId}</span>
	</div>
	<div class="user_view">
		Name: <input name="username" maxLength="50" value="{name}" style="display:{formView}">
		<span class="user_view_keys" style="display:{formViewSpan}">{name}</span>
	</div>
	<div class="user_view" style="display:{expView}">
		Exp: <strong>{exp}</strong> &nbsp;&nbsp; {user_lv}
		<br/>
		RA: <div class="rating_static" id="rating_93">{ratingA}</div>
		<br/>
		RB: <div class="rating_static" id="rating_94">{ratingB}</div>
	</div>
	<div class="user_view" style="display:{pwdView}">Password: <input name="password" type="password" maxLength="20" value=""></div>
	<div class="user_view" style="display:{pwdView}">Password (confirm): <input name="password1" type="password" maxLength="20" value=""></div>
	<div class="user_view">Email: 
		<input name="email" maxLength="50" value="{email}" style="display:{formView}">
		<span class="user_view_keys" style="display:{formViewSpan}">{email}</span>
	</div>
	<div class="user_view"><strong>Self Introduction</strong><br/>
		<div id="user_intro" style="display:{formViewSpan}">{selfIntro}</div>
		<textarea id="user_intro_edit" name="selfIntro" style="display:{formView}">{selfIntro}</textarea>
	</div>
	<input class="general_button" style="display:{buttonView}" type="submit" value="OK" width="100px" />
	<input class="general_button" style="display:{buttonView}" type="button" value="Cancel" width="100px" onClick="window.history.back()" />
	<input class="general_button" style="display:{expView}" type="button" value="Back" onClick="goToLink('{backLink}');" />
</form>
</div>
</html>